.set NUM_OPPONENTS, VAR_0x8009

BerryBlender_Text_WantToMakePokeblocks:
	.string "哦？想和我这个老头子\n一起制作些宝可方块吗？$"

BerryBlender_Text_Excellent:
	.string "非常好！$"

BerryBlender_Text_MadeOldTimerSad:
	.string "哎呀……\n你让老头子伤心了……$"

BerryBlender_Text_KnowHowToMakePokeblocks:
	.string "你知道怎么做宝可方块吧？$"

BerryBlender_Text_LetsBerryBlender:
	.string "那么我们就开始吧！\p让我们混合树果！$"

BerryBlender_Text_ExplainBerryBlending:
	.string "好吧，\n我来简单说明下。\p别担心，\n很简单的。\p当混合器的箭头转到你的标记时，\n按下A键就行。\p就这么简单。\n你试试就知道有多容易了。$"

BerryBlender_Text_DontHaveAnyBerries:
	.string "咦？\n你没有树果吗？\p没有树果的话，\n就做不了宝可方块啦。$"

BerryBlender_Text_CanHaveOneOfMyBerries:
	.string "哎呀，这可不行啊。\p如果你不介意是剩下的，\n我可以给你一个我的树果。\p这样我们就能用树果混合器\n一起制作宝可方块了。$"

BerryBlender_Text_DontHaveAnyBerriesToSpare:
	.string "要是我有剩下的树果，\n肯定会乐意给你一个……\p但今天实在没有多余的。\n我们改天再试吧。$"

BerryBlender_Text_PokeblockCaseIsFull:
	.string "但你的宝可方块盒已经满了。\p下次来找我之前，\n先用掉一些宝可方块吧。$"

BerryBlender_Text_DontHavePokeblockCase:
	.string "但你还没有宝可方块盒。\p先有个宝可方块盒\n再来找我吧。$"

BerryBlender_Text_LetsGetBlendingAlready:
	.string "我们赶快开始混合吧！$"

BerryBlender_Text_WhatKindOfPokeblockWillIGet:
	.string "我会得到什么样的宝可方块呢？\n真让人期待啊！$"

BerryBlender_Text_WantToBlendPokeblocksWithUs:
	.string "嗨！想和我们一起\n制作宝可方块吗？$"

BerryBlender_Text_Okay:
	.string "好的！$"

BerryBlender_Text_ThatsTooBad:
	.string "真遗憾……\p不过只要你想要混合，\n我们随时都在这里哦！$"

BerryBlender_Text_KnowHowToMakePokeblocks2:
	.string "你肯定知道怎么制作\n宝可方块，对吧？$"

BerryBlender_Text_LetsBerryBlender2:
	.string "那就开始吧！\p让我们来树果混合吧！$"

BerryBlender_Text_ExplainBerryBlending2:
	.string "好的！\n让我来为你说明！\p当旋转的搅拌器箭头\n到达你的标记时，\l按下A键即可。\p就这么简单。\n很容易理解吧？$"

BerryBlender_Text_DontHaveAnyBerries2:
	.string "啊，请稍等一下……\n你没有树果呢。\p没有树果的话就做不了\n宝可方块了……\p我们随时都在这里，\n等你找到树果再来混合吧。$"

BerryBlender_Text_PokeblockCaseIsFull2:
	.string "啊，请稍等一下……\n你的宝可方块盒已经满了。\p你应该先用掉些宝可方块\n然后再回来。$"

BerryBlender_Text_DontHavePokeblockCase2:
	.string "啊，请稍等一下……\n你还没有宝可方块盒呢。\p你应该先获得一个宝可方块盒\n然后再回来。$"

@ Unused
BerryBlender_Text_MakePokeblocksWithOurGroup:
	.string "喔，你好！你想和我们小组\n"
	.string "一起做宝可方块吗？$"

BerryBlender_Text_OhDear:
	.string "哎呀！$"

BerryBlender_Text_LeftUsInShock:
	.string "哎呀呀……\p你让我们大吃一惊呢！$"

BerryBlender_Text_KnowHowToMakePokeblocks3:
	.string "你当然知道怎么制作\n宝可方块，对吧？$"

BerryBlender_Text_LetsBerryBlender3:
	.string "好呀，亲爱的！\n我们开始吧！\p让我们来树果混合吧！$"

BerryBlender_Text_ExplainBerryBlending3:
	.string "哎呀！\p那我好好给你解释下。\p当搅拌器的箭头转到\n你的标记时，按下A键。\p就这么简单。\n是不是很容易？$"

BerryBlender_Text_DontHaveAnyBerries3:
	.string "你没有树果，\n对吧？\p如果没有树果，\n就做不了宝可方块。\p我们一直在这里制作宝可方块，\n等你找到一两颗树果后\l我们再一起制作吧。$"

BerryBlender_Text_PokeblockCaseIsFull3:
	.string "看起来你的宝可方块盒\n已经满了。\p你应该先用掉些宝可方块\n然后再回来。$"

BerryBlender_Text_DontHavePokeblockCase3:
	.string "看起来你还没有\n获得宝可方块盒呢。\p你需要先有个宝可方块盒\n再回来。$"

BerryBlender_Text_SetNewBlenderRecord:
	.string "好吧！今天我要创造混合器\n速度的新纪录！$"

BerryBlender_Text_LookGoodAtBlendingJoinUs:
	.string "哎呀！\n你看起来很擅长混合呢。\l要加入我们吗？$"

BerryBlender_Text_MakeDeliciousPokeblocks:
	.string "我要制作美味的宝可方块\n让我的宝可梦更可爱。$"

BerryBlender_Text_SaveGameBeforeBerryBlenderLink:
	.string "宝可方块将和朋友们一起\n用树果在树果混合器中制作。\p在和朋友连接前需要先写入记录，\n可以吗？$"

BerryBlender_Text_SearchingForFriends:
	.string "正在寻找你的朋友……\n"
	.string "…… B键：取消$"

BerryBlender_Text_Player1Arrived:
	.string "{STR_VAR_1}到了。$"

BerryBlender_Text_Player1And2Arrived:
	.string "{STR_VAR_1}和{STR_VAR_2}到了。$"

BerryBlender_Text_AllPlayersArrived:
	.string "{STR_VAR_1}、{STR_VAR_2}和\n"
	.string "{STR_VAR_3}到了。$"

BerryBlender_Text_NoBerriesLink:
	.string "你没有树果。\n无法使用树果混合器。$"

BerryBlender_Text_PokeblockCaseIsFullLink:
	.string "你的宝可方块盒已满。\n无法使用树果混合器。$"

BerryBlender_Text_DontHavePokeblockCaseLink:
	.string "你没有宝可方块盒。\n无法使用树果混合器。$"

BerryBlender_Text_LoveMakingPokeblocks:
	.string "我超喜欢制作宝可方块。\p总是随身带着树果。$"

BerryBlender_Text_MakePokeblocksUsingBerryBlender:
	.string "如果你愿意，我们可以用树果混合器\n一起制作宝可方块。$"

BerryBlender_Text_DontHaveAnyBerriesHaveOne:
	.string "哦？\n你没有树果吗？\p哎呀，这可不行啊。\p如果你不介意是剩下的，\n我可以给你一个我的树果。$"

BerryBlender_Text_UseItToMakePokeblocksTogether:
	.string "我们可以用它在树果混合器里\n一起制作宝可方块。$"

BerryBlender_Text_DontHaveAnyBerriesNoneToSpare:
	.string "哎呀？\n你身上没有树果吗？\p要是我有剩下的，\n一定乐意分你一颗……\p可惜今天我也没多余的。\n实在不好意思啊。$"

BerryBlender_EventScript_BerryBlender1::
	lockall
	goto_if_unset FLAG_HIDE_LILYCOVE_CONTEST_HALL_BLEND_MASTER, BerryBlender_EventScript_BlendMasterPresent
	setvar NUM_OPPONENTS, 1
	applymovement LOCALID_BLEND_MASTER, BerryBlender_Movement_BlendLeaderWalkInPlace
	waitmovement 0
	msgbox BerryBlender_Text_WantToMakePokeblocks, MSGBOX_YESNO
	goto_if_eq VAR_RESULT, YES, BerryBlender_EventScript_TryUseBerryBlender1
	goto BerryBlender_EventScript_DeclineBlender1
	end

BerryBlender_EventScript_DeclineBlender1:
	msgbox BerryBlender_Text_MadeOldTimerSad, MSGBOX_DEFAULT
	releaseall
	end

BerryBlender_EventScript_Blender1NoBerries:
	msgbox BerryBlender_Text_DontHaveAnyBerries, MSGBOX_DEFAULT
	dotimebasedevents
	goto_if_set FLAG_DAILY_CONTEST_LOBBY_RECEIVED_BERRY, BerryBlender_EventScript_Blender1NoSpareBerries
	goto BerryBlender_EventScript_Blender1GiveSpareBerry
	end

BerryBlender_EventScript_Blender1NoSpareBerries:
	msgbox BerryBlender_Text_DontHaveAnyBerriesToSpare, MSGBOX_DEFAULT
	releaseall
	end

BerryBlender_EventScript_Blender1GiveSpareBerry:
	msgbox BerryBlender_Text_CanHaveOneOfMyBerries, MSGBOX_DEFAULT
	giveitem ITEM_PECHA_BERRY
	setflag FLAG_DAILY_CONTEST_LOBBY_RECEIVED_BERRY
	goto BerryBlender_EventScript_UseBerryBlender1
	end

BerryBlender_EventScript_UseBerryBlender1:
	msgbox BerryBlender_Text_KnowHowToMakePokeblocks, MSGBOX_YESNO
	goto_if_eq VAR_RESULT, YES, BerryBlender_EventScript_StartBlender1
	goto BerryBlender_EventScript_ExplainBlending1
	end

BerryBlender_EventScript_StartBlender1:
	msgbox BerryBlender_Text_LetsBerryBlender, MSGBOX_DEFAULT
	goto BerryBlender_EventScript_DoBerryBlending
	end

BerryBlender_EventScript_ExplainBlending1:
	msgbox BerryBlender_Text_ExplainBerryBlending, MSGBOX_DEFAULT
	goto BerryBlender_EventScript_StartBlender1
	end

BerryBlender_EventScript_TryUseBerryBlender1:
	checkitem ITEM_POKEBLOCK_CASE
	goto_if_eq VAR_RESULT, FALSE, BerryBlender_EventScript_Blender1NoCase
	specialvar VAR_RESULT, GetFirstFreePokeblockSlot
	goto_if_eq VAR_RESULT, 65535, BerryBlender_EventScript_Blender1CaseFull
	specialvar VAR_RESULT, PlayerHasBerries
	goto_if_eq VAR_RESULT, FALSE, BerryBlender_EventScript_Blender1NoBerries
	msgbox BerryBlender_Text_Excellent, MSGBOX_DEFAULT
	goto BerryBlender_EventScript_UseBerryBlender1
	end

BerryBlender_EventScript_DoBerryBlending:
	copyvar VAR_0x8004, NUM_OPPONENTS
	fadescreen FADE_TO_BLACK
	special DoBerryBlending
	waitstate
	releaseall
	end

BerryBlender_EventScript_Blender1CaseFull:
	msgbox BerryBlender_Text_PokeblockCaseIsFull, MSGBOX_DEFAULT
	releaseall
	end

BerryBlender_EventScript_Blender1NoCase:
	msgbox BerryBlender_Text_DontHavePokeblockCase, MSGBOX_DEFAULT
	releaseall
	end

BerryBlender_EventScript_BerryBlender2::
	lockall
	setvar NUM_OPPONENTS, 2
	applymovement LOCALID_CONTEST_LOBBY_BLENDER_2_PARTICIPANT, Common_Movement_FaceOriginalDirection
	applymovement LOCALID_CONTEST_LOBBY_BLENDER_2_LEADER, BerryBlender_Movement_BlendLeaderWalkInPlace
	waitmovement 0
	msgbox BerryBlender_Text_WantToBlendPokeblocksWithUs, MSGBOX_YESNO
	goto_if_eq VAR_RESULT, YES, BerryBlender_EventScript_TryUseBerryBlender2
	goto BerryBlender_EventScript_DeclineBlender2
	end

BerryBlender_EventScript_DeclineBlender2:
	msgbox BerryBlender_Text_ThatsTooBad, MSGBOX_DEFAULT
	releaseall
	end

BerryBlender_EventScript_Blender2NoBerries:
	msgbox BerryBlender_Text_DontHaveAnyBerries2, MSGBOX_DEFAULT
	release
	end

BerryBlender_EventScript_UseBerryBlender2:
	msgbox BerryBlender_Text_KnowHowToMakePokeblocks2, MSGBOX_YESNO
	goto_if_eq VAR_RESULT, YES, BerryBlender_EventScript_StartBlender2
	goto BerryBlender_EventScript_ExplainBlending2
	end

BerryBlender_EventScript_StartBlender2:
	msgbox BerryBlender_Text_LetsBerryBlender2, MSGBOX_DEFAULT
	goto BerryBlender_EventScript_DoBerryBlending
	end

BerryBlender_EventScript_ExplainBlending2:
	msgbox BerryBlender_Text_ExplainBerryBlending2, MSGBOX_DEFAULT
	goto BerryBlender_EventScript_StartBlender2
	end

BerryBlender_EventScript_TryUseBerryBlender2:
	specialvar VAR_RESULT, PlayerHasBerries
	goto_if_eq VAR_RESULT, FALSE, BerryBlender_EventScript_Blender2NoBerries
	checkitem ITEM_POKEBLOCK_CASE
	goto_if_eq VAR_RESULT, FALSE, BerryBlender_EventScript_Blender2NoCase
	msgbox BerryBlender_Text_Okay, MSGBOX_DEFAULT
	specialvar VAR_RESULT, GetFirstFreePokeblockSlot
	goto_if_ne VAR_RESULT, 65535, BerryBlender_EventScript_UseBerryBlender2
	goto_if_eq VAR_RESULT, 65535, BerryBlender_EventScript_Blender2CaseFull
	end

BerryBlender_EventScript_Blender2CaseFull:
	msgbox BerryBlender_Text_PokeblockCaseIsFull2, MSGBOX_DEFAULT
	releaseall
	end

BerryBlender_EventScript_Blender2NoCase:
	msgbox BerryBlender_Text_DontHavePokeblockCase2, MSGBOX_DEFAULT
	releaseall
	end

BerryBlender_EventScript_BerryBlender3::
	lockall
	setvar VAR_0x8008, LOCALID_CONTEST_LOBBY_BLENDER_3_LEADER
	setvar NUM_OPPONENTS, 3
	applymovement LOCALID_CONTEST_LOBBY_BLENDER_3_PARTICIPANT_1, Common_Movement_FaceOriginalDirection
	applymovement LOCALID_CONTEST_LOBBY_BLENDER_3_PARTICIPANT_2, Common_Movement_FaceOriginalDirection
	applymovement VAR_0x8008, BerryBlender_Movement_BlendLeaderWalkInPlace
	waitmovement 0
	msgbox BerryBlender_Text_LookGoodAtBlendingJoinUs, MSGBOX_YESNO
	goto_if_eq VAR_RESULT, YES, BerryBlender_EventScript_TryUseBlender3
	goto BerryBlender_EventScript_DeclineBlender3
	end

BerryBlender_EventScript_DeclineBlender3:
	msgbox BerryBlender_Text_LeftUsInShock, MSGBOX_DEFAULT
	releaseall
	end

BerryBlender_EventScript_Blender3NoBerries:
	msgbox BerryBlender_Text_DontHaveAnyBerries3, MSGBOX_DEFAULT
	release
	end

BerryBlender_EventScript_UseBerryBlender3:
	msgbox BerryBlender_Text_KnowHowToMakePokeblocks3, MSGBOX_YESNO
	goto_if_eq VAR_RESULT, YES, BerryBlender_EventScript_StartBlender3
	goto BerryBlender_EventScript_ExplainBlending3
	end

BerryBlender_EventScript_StartBlender3:
	msgbox BerryBlender_Text_LetsBerryBlender3, MSGBOX_DEFAULT
	goto BerryBlender_EventScript_DoBerryBlending
	end

BerryBlender_EventScript_ExplainBlending3:
	msgbox BerryBlender_Text_ExplainBerryBlending3, MSGBOX_DEFAULT
	goto BerryBlender_EventScript_StartBlender3
	end

BerryBlender_EventScript_TryUseBlender3:
	specialvar VAR_RESULT, PlayerHasBerries
	goto_if_eq VAR_RESULT, FALSE, BerryBlender_EventScript_Blender3NoBerries
	checkitem ITEM_POKEBLOCK_CASE
	goto_if_eq VAR_RESULT, FALSE, BerryBlender_EventScript_Blender3NoCase
	msgbox BerryBlender_Text_OhDear, MSGBOX_DEFAULT
	specialvar VAR_RESULT, GetFirstFreePokeblockSlot
	goto_if_ne VAR_RESULT, 65535, BerryBlender_EventScript_UseBerryBlender3
	goto_if_eq VAR_RESULT, 65535, BerryBlender_EventScript_Blender3CaseFull
	end

BerryBlender_EventScript_Blender3CaseFull:
	msgbox BerryBlender_Text_PokeblockCaseIsFull3, MSGBOX_DEFAULT
	releaseall
	end

BerryBlender_EventScript_Blender3NoCase:
	msgbox BerryBlender_Text_DontHavePokeblockCase3, MSGBOX_DEFAULT
	releaseall
	end

BerryBlender_EventScript_BlendMasterPresent:
	lockall
	setvar NUM_OPPONENTS, 1
	msgbox BerryBlender_Text_SeeMyMasteryInAction, MSGBOX_YESNO
	goto_if_eq VAR_RESULT, YES, BerryBlender_EventScript_TryBlendWithBlendMaster
	msgbox BerryBlender_Text_TooBusyNowIsee, MSGBOX_DEFAULT
	releaseall
	end

BerryBlender_EventScript_BlendMasterNoBerries:
	msgbox BerryBlender_Text_BlendMasterNoBerries, MSGBOX_DEFAULT
	releaseall
	end

BerryBlender_EventScript_TryBlendWithBlendMaster:
	checkitem ITEM_POKEBLOCK_CASE
	goto_if_eq VAR_RESULT, FALSE, BerryBlender_EventScript_BlendMasterNoCase
	specialvar VAR_RESULT, PlayerHasBerries
	goto_if_eq VAR_RESULT, FALSE, BerryBlender_EventScript_BlendMasterNoBerries
	specialvar VAR_RESULT, GetFirstFreePokeblockSlot
	goto_if_ne VAR_RESULT, 65535, BerryBlender_EventScript_BlendWithBlendMaster
	goto_if_eq VAR_RESULT, 65535, BerryBlender_EventScript_BlendMasterCaseFull
	end

BerryBlender_EventScript_BlendWithBlendMaster:
	msgbox BerryBlender_Text_BlendMasterKnowHowToMakePokeblocks, MSGBOX_YESNO
	call_if_eq VAR_RESULT, NO, BerryBlender_EventScript_BlendMasterExplainBlending
	msgbox BerryBlender_Text_BlendMasterLetsBerryBlender, MSGBOX_DEFAULT
	goto BerryBlender_EventScript_DoBerryBlending
	end

BerryBlender_EventScript_BlendMasterExplainBlending:
	msgbox BerryBlender_Text_BlendMasterExplainBerryBlending, MSGBOX_DEFAULT
	return

BerryBlender_EventScript_BlendMasterNoCase:
	msgbox BerryBlender_Text_BlendMasterNoPokeblockCase, MSGBOX_DEFAULT
	releaseall
	end

BerryBlender_EventScript_BlendMasterCaseFull:
	msgbox BerryBlender_Text_BlendMasterPokeblockCaseFull, MSGBOX_DEFAULT
	releaseall
	end

BerryBlender_EventScript_Blender2Man::
	msgbox BerryBlender_Text_SetNewBlenderRecord, MSGBOX_NPC
	end

BerryBlender_EventScript_Blender3PokefanF::
	msgbox BerryBlender_Text_LookGoodAtBlendingJoinUs, MSGBOX_NPC
	end

BerryBlender_EventScript_Blender2Twin::
	msgbox BerryBlender_Text_MakeDeliciousPokeblocks, MSGBOX_NPC
	end

BerryBlender_EventScript_Blender1ExpertM::
	setvar VAR_0x8008, 15
	goto BerryBlender_EventScript_ExpertMCheckGiveBerry
	end

BerryBlender_EventScript_ExpertMCheckGiveBerry:
	lock
	faceplayer
	msgbox BerryBlender_Text_LoveMakingPokeblocks, MSGBOX_DEFAULT
	specialvar VAR_RESULT, PlayerHasBerries
	goto_if_eq VAR_RESULT, TRUE, BerryBlender_EventScript_ExpertMPlayerHasBerries
	goto_if_eq VAR_RESULT, FALSE, BerryBlender_EventScript_ExpertMNoBerries
	end

BerryBlender_EventScript_ExpertMPlayerHasBerries:
	msgbox BerryBlender_Text_MakePokeblocksUsingBerryBlender, MSGBOX_DEFAULT
	release
	end

BerryBlender_EventScript_ExpertMNoBerries:
	checkitem ITEM_POKEBLOCK_CASE
	goto_if_eq VAR_RESULT, FALSE, BerryBlender_EventScript_ExpertMNoSpareBerries
	specialvar VAR_RESULT, GetFirstFreePokeblockSlot
	goto_if_eq VAR_RESULT, 65535, BerryBlender_EventScript_ExpertMNoSpareBerries
	dotimebasedevents
	goto_if_set FLAG_DAILY_CONTEST_LOBBY_RECEIVED_BERRY, BerryBlender_EventScript_ExpertMNoSpareBerries
	goto BerryBlender_EventScript_ExpertMGiveBerry
	end

BerryBlender_EventScript_ExpertMNoSpareBerries:
	msgbox BerryBlender_Text_DontHaveAnyBerriesNoneToSpare, MSGBOX_DEFAULT
	release
	end

BerryBlender_EventScript_ExpertMGiveBerry:
	msgbox BerryBlender_Text_DontHaveAnyBerriesHaveOne, MSGBOX_DEFAULT
	giveitem ITEM_PECHA_BERRY
	setflag FLAG_DAILY_CONTEST_LOBBY_RECEIVED_BERRY
	msgbox BerryBlender_Text_UseItToMakePokeblocksTogether, MSGBOX_DEFAULT
	release
	end

BerryBlender_Movement_BlendLeaderWalkInPlace:
	walk_in_place_faster_right
	step_end

BerryBlender_EventScript_BerryBlenderLink::
	lockall
	specialvar VAR_RESULT, PlayerHasBerries
	goto_if_eq VAR_RESULT, FALSE, BerryBlender_EventScript_LinkBlenderNoBerries
	checkitem ITEM_POKEBLOCK_CASE
	goto_if_eq VAR_RESULT, FALSE, BerryBlender_EventScript_LinkBlenderNoCase
	specialvar VAR_RESULT, GetFirstFreePokeblockSlot
	goto_if_ne VAR_RESULT, 65535, BerryBlender_EventScript_LinkBlenderSaveGame
	goto_if_eq VAR_RESULT, 65535, BerryBlender_EventScript_LinkBlenderCaseFull
	end

BerryBlender_EventScript_LinkBlenderSaveGame:
	msgbox BerryBlender_Text_SaveGameBeforeBerryBlenderLink, MSGBOX_YESNO
	goto_if_eq VAR_RESULT, YES, BerryBlender_EventScript_TryDoLinkBlender
	goto_if_eq VAR_RESULT, NO, BerryBlender_EventScript_CancelLinkBlender
	end

BerryBlender_EventScript_LinkBlenderNoBerries:
	msgbox BerryBlender_Text_NoBerriesLink, MSGBOX_DEFAULT
	releaseall
	end

BerryBlender_EventScript_TryDoLinkBlender:
	call Common_EventScript_SaveGame
	goto_if_eq VAR_RESULT, FALSE, BerryBlender_EventScript_CancelLinkBlender
	specialvar VAR_RESULT, IsWirelessAdapterConnected
	goto_if_eq VAR_RESULT, TRUE, BerryBlender_EventScript_StartDecideLinkLeader
	message BerryBlender_Text_SearchingForFriends
	waitmessage
	special TryBerryBlenderLinkup
	waitstate
	goto_if_eq VAR_RESULT, LINKUP_SUCCESS, BerryBlender_EventScript_SpawnLinkPartners
	goto_if_eq VAR_RESULT, LINKUP_SOMEONE_NOT_READY, BerryBlender_EventScript_CloseLinkNotReady
	goto_if_eq VAR_RESULT, LINKUP_DIFF_SELECTIONS, BerryBlender_EventScript_CloseLinkDifferentSelections
	goto_if_eq VAR_RESULT, LINKUP_FAILED, BerryBlender_EventScript_CloseLink
	goto_if_eq VAR_RESULT, LINKUP_CONNECTION_ERROR, BerryBlender_EventScript_LinkError
	end

BerryBlender_EventScript_TwoPlayerLink:
	msgbox BerryBlender_Text_Player1Arrived, MSGBOX_DEFAULT
	goto BerryBlender_EventScript_DoLinkBerryBlending
	end

BerryBlender_EventScript_ThreePlayerLink:
	msgbox BerryBlender_Text_Player1And2Arrived, MSGBOX_DEFAULT
	goto BerryBlender_EventScript_DoLinkBerryBlending
	end

BerryBlender_EventScript_FourPlayerLink:
	msgbox BerryBlender_Text_AllPlayersArrived, MSGBOX_DEFAULT
	goto BerryBlender_EventScript_DoLinkBerryBlending
	end

BerryBlender_EventScript_DoLinkBerryBlending:
	setvar VAR_0x8004, 0  @ number of opponents, 0 indicates Link
	fadescreen FADE_TO_BLACK
	removeobject 240 @ Unclear where these local IDs come from,
	removeobject 239 @ but presumably they'd be the 4 link players
	removeobject 238
	removeobject 237
	special DoBerryBlending
	waitstate
	releaseall
	end

BerryBlender_EventScript_CancelLinkBlender:
	releaseall
	end

BerryBlender_EventScript_LinkBlenderCaseFull:
	msgbox BerryBlender_Text_PokeblockCaseIsFullLink, MSGBOX_DEFAULT
	releaseall
	end

BerryBlender_EventScript_LinkBlenderNoCase:
	msgbox BerryBlender_Text_DontHavePokeblockCaseLink, MSGBOX_DEFAULT
	releaseall
	end

BerryBlender_EventScript_CloseLinkNotReady:
	special CloseLink
	msgbox Text_SomeoneIsNotReadyToLink, MSGBOX_DEFAULT
	releaseall
	end

BerryBlender_EventScript_CloseLinkDifferentSelections:
	special CloseLink
	msgbox Text_PlayersMadeDifferentSelections, MSGBOX_DEFAULT
	releaseall
	end

BerryBlender_EventScript_CloseLink:
	special CloseLink
	msgbox gText_PokeblockLinkCanceled, MSGBOX_DEFAULT
	releaseall
	end

BerryBlender_EventScript_LinkError:
	special CloseLink
	msgbox Text_LinkErrorPleaseReset, MSGBOX_DEFAULT
	releaseall
	end

BerryBlender_EventScript_SpawnLinkPartners:
	fadescreen FADE_TO_BLACK
	specialvar VAR_RESULT, GetLinkPartnerNames
	copyvar VAR_0x8008, VAR_RESULT
	copyvar VAR_0x8004, VAR_0x8008
	special SpawnLinkPartnerObjectEvent
	goto BerryBlender_EventScript_LinkPlayersArrived
	end

BerryBlender_EventScript_LinkPlayersArrived:
	fadescreen FADE_FROM_BLACK
	switch VAR_0x8008
	case 2, BerryBlender_EventScript_TwoPlayerLink
	case 3, BerryBlender_EventScript_ThreePlayerLink
	case 4, BerryBlender_EventScript_FourPlayerLink
	end

BerryBlender_EventScript_StartDecideLinkLeader:
	setvar VAR_0x8004, LINK_GROUP_BERRY_BLENDER
	goto BerryBlender_EventScript_DecideLinkLeader
	end

BerryBlender_EventScript_DecideLinkLeader:
	message LilycoveCity_ContestLobby_Text_PleaseDecideLinkLeader
	waitmessage
	multichoice 16, 6, MULTI_LINK_LEADER, FALSE
	switch VAR_RESULT
	case 0, BerryBlender_EventScript_TryJoinGroup
	case 1, BerryBlender_EventScript_TryLeadGroup
	case 2, BerryBlender_EventScript_CloseLink
	case MULTI_B_PRESSED, BerryBlender_EventScript_CloseLink
	end

BerryBlender_EventScript_TryLeadGroup:
	call BerryBlender_EventScript_TryBecomeLinkLeader
	goto_if_eq VAR_RESULT, LINKUP_SUCCESS, BerryBlender_EventScript_LinkLeaderDecided
	goto_if_eq VAR_RESULT, LINKUP_FAILED, BerryBlender_EventScript_DecideLinkLeader
	goto_if_eq VAR_RESULT, LINKUP_RETRY_ROLE_ASSIGN, BerryBlender_EventScript_TryLeadGroup
	release
	end

BerryBlender_EventScript_TryJoinGroup:
	call BerryBlender_EventScript_TryJoinLinkGroup
	goto_if_eq VAR_RESULT, LINKUP_SUCCESS, BerryBlender_EventScript_LinkLeaderDecided
	goto_if_eq VAR_RESULT, LINKUP_FAILED, BerryBlender_EventScript_DecideLinkLeader
	goto_if_eq VAR_RESULT, LINKUP_RETRY_ROLE_ASSIGN, BerryBlender_EventScript_TryJoinGroup
	release
	end

BerryBlender_EventScript_TryBecomeLinkLeader:
	special TryBecomeLinkLeader
	waitstate
	return

BerryBlender_EventScript_TryJoinLinkGroup:
	special TryJoinLinkGroup
	waitstate
	return

BerryBlender_EventScript_LinkLeaderDecided:
	goto BerryBlender_EventScript_SpawnLinkPartners
	end
